package controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class TransmitController {
	
	@RequestMapping("/transmit")
	public void chatroom(HttpServletRequest req, HttpServletResponse res) {
		res.setCharacterEncoding("utf-8");
		String addr = req.getParameter("address");
		String param = req.getParameter("param");
		try {
			res.setCharacterEncoding("utf-8");
			PrintWriter pw = res.getWriter();
			String result = SendPack.sendGet(addr, param);
			pw.print(result);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
